package com.zenithmind.exam.pojo.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import jakarta.validation.constraints.NotBlank;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 答题记录实体类
 * 
 * @author ZenithMind
 * @since 2024-07-01
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Schema(name = "答题记录实体", description = "答题记录信息")
@TableName("exam_answer_record")
public class AnswerRecord {

    /**
     * 主键ID
     */
    @Schema(description = "主键ID")
    @TableId(type = IdType.ASSIGN_ID)
    private String id;

    /**
     * 考试记录ID
     */
    @NotBlank(message = "考试记录ID不能为空")
    @Schema(description = "考试记录ID")
    private String examRecordId;

    /**
     * 题目ID
     */
    @NotBlank(message = "题目ID不能为空")
    @Schema(description = "题目ID")
    private String questionId;

    /**
     * 题目类型
     */
    @Schema(description = "题目类型")
    private Integer questionType;

    /**
     * 题目分值
     */
    @Schema(description = "题目分值")
    private Integer questionScore;

    /**
     * 用户答案（JSON格式）
     */
    @Schema(description = "用户答案（JSON格式）")
    private String userAnswer;

    /**
     * 正确答案（JSON格式）
     */
    @Schema(description = "正确答案（JSON格式）")
    private String correctAnswer;

    /**
     * 用户得分
     */
    @Schema(description = "用户得分")
    private BigDecimal userScore;

    /**
     * 是否正确（0:错误, 1:正确, 2:部分正确）
     */
    @Schema(description = "是否正确（0:错误, 1:正确, 2:部分正确）")
    private Integer isCorrect;

    /**
     * 答题时间
     */
    @Schema(description = "答题时间")
    private LocalDateTime answerTime;

    /**
     * 答题用时（秒）
     */
    @Schema(description = "答题用时（秒）")
    private Integer timeSpent;

    /**
     * 创建时间
     */
    @Schema(description = "创建时间")
    private LocalDateTime createTime;
}
